<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Global block configuration settings file.
 *
 * @package   blocks-email_list
 * @author    Justin Filip <jfilip@remote-learner.net>
 * @copyright 2010 Remote Learner - http://www.remote-learner.net/
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

require_once($CFG->dirroot . '/blocks/email_list/email/lib.php');


$optionsyn = array(0 => get_string('no'), 1 => get_string('yes'));

$settings->add(new admin_setting_configselect('email_enable_ssl', 'email_enable_ssl',
                   get_string('enable_ssl', 'block_email_list'), 0, $optionsyn));

$settings->add(new admin_setting_configselect('email_trackbymail', 'email_trackbymail',
                   get_string('configtrackbymail', 'block_email_list'),
                   EMAIL_TRACKBYMAIL, $optionsyn));

$settings->add(new admin_setting_configselect('email_marriedfolders2courses', 'email_marriedfolders2courses',
                   get_string('configmarriedfolders2courses', 'block_email_list'),
                   EMAIL_MARRIEDFOLDERS2COURSES, $optionsyn));

$settings->add(new admin_setting_configselect('email_old_select_participants', 'email_old_select_participants',
                   get_string('configold_select_participants', 'block_email_list'), 0, $optionsyn));

$settings->add(new admin_setting_configselect('email_add_admins', 'email_add_admins',
                   get_string('add_admins', 'block_email_list'), 1, $optionsyn));

/*
$settings->add(new admin_setting_configselect('email_enable_ajax', 'email_enable_ajax',
                   get_string('enable_ajax', 'block_email_list'), 0, $optionsyn));
*/

$settings->add(new admin_setting_configtext('email_answered_color', 'email_answered_color',
                   get_string('configanswered_color', 'block_email_list'),
                   EMAIL_ANSWERED_COLOR, PARAM_NOTAGS, 7));

$settings->add(new admin_setting_configtext('email_table_field_color', 'email_table_field_color',
                   get_string('configtable_field_color', 'block_email_list'),
                   EMAIL_TABLE_FIELD_COLOR, PARAM_NOTAGS, 7));

$options = array(0 => get_string('all'));

for ($i = 5; $i <= 50; $i += 5) {
    $options[$i] = $i;
}

$settings->add(new admin_setting_configselect('email_max_number_courses', 'email_max_number_courses',
                   get_string('configmaxnumbercourses', 'block_email_list'),
                   EMAIL_MAX_NUMBER_COURSES, $options));

$settings->add(new admin_setting_configtext('block_email_list_refresh_rate',
                   get_string('emailrefreshrate', 'block_email_list'),
                   get_string('configemailrefreshrate', 'block_email_list'),
                   EMAIL_AUTO_REFRESH_RATE, // default refresh rate
                   PARAM_INT));

if (empty($CFG->noemailever)) {
    $externaladdresslabel = 'configemailexternaladdress';
} else {
    $externaladdresslabel = 'externalemaildisabled';
    $optionsyn = array(0 => get_string('no'));
    // Force setting so that we don't see the message "Invalid current value: 1".
    set_config('email_enable_external_address', 0);
}

$settings->add(new admin_setting_configselect('email_enable_external_address',
               get_string('emailenableexternaladdress', 'block_email_list'),
               get_string($externaladdresslabel, 'block_email_list'), 0, $optionsyn));
